/*type Pair[+A,+B]=Tuple2[A,B]

object Pair{
  val resv="hello"
  def apply[A, B](x: A, y: B) = Tuple2(x, y)
  def unapply[A, B](x: Tuple2[A, B]): Option[Tuple2[A, B]] = Some(x)
}

val a=Pair
//println(a)
println(a.resv)
*/

val lst=List(1,2.2,"hi");
println(lst);

lst match{
  case List(x,y,_*) => println(x);println(y)
  case _ => print("fk");
}

class MyName(val g:String, val s:String)

object MyName{
  def apply(g:String,s:String) = new MyName(g,s)
  def unapply(n:MyName) = Some(n.s)
}

println(MyName("Hui","Song")) 
val me=List(MyName("Hui","Song"),MyName("Youjun","Song"), MyName("Yanjun", "Liu"))
for(n <- me){
  n match{
    case MyName("Song") => printf("is a Song")
    case _ => printf("Not")
  }
}
